#include "instanceobj.h"
#include <qsciscintilla.h>
#include <Scintilla.h>
#include <QWidget>
#include <QMenu>
#include "./src/ZhConvertClass.h"

extern std::function<QsciScintilla* (QWidget*)> s_getCurEdit;

InstanceObj::InstanceObj(QWidget* pNotepad, QMenu* pMenu) :QObject(pNotepad), m_exportObj(nullptr)
{
	m_pNotepad = pNotepad;
	m_rootMenu = pMenu;
}

InstanceObj::~InstanceObj()
{
	if (m_exportObj != nullptr)
	{
		delete m_exportObj;
		m_exportObj = nullptr;
	}
}

void InstanceObj::init()
{
	if (m_exportObj == nullptr)
	{
		m_exportObj = new ZhConvertClass(this, m_pNotepad);
	}
}

void InstanceObj::doSimpletoTra()
{
	init();
	m_exportObj->on_SimpletoTra();
}

void InstanceObj::doTraToSimple()
{
	init();
	m_exportObj->on_TraToSimple();
}

void InstanceObj::doOpenTradFix()
{
	init();
	m_exportObj->on_OpenTradFix();
}





